/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>

#include "sle_ssap_client_server.h"
#include "sle_ssap_client_callback_stub.h"

class SleSsapClientCallbackTest : public testing::Test {
public:
    static void SetUpTestCase();
    static void TearDownTestCase();
    void SetUp() override;
    void TearDown() override;

};
void SleSsapClientCallbackTest::SetUp(){}
void SleSsapClientCallbackTest::TearDown(){}
void SleSsapClientCallbackTest::SetUpTestCase(){}
void SleSsapClientCallbackTest::TearDownTestCase(){}

namespace OHOS {
namespace NearLink {
namespace SleStandard {
class SleSsapClientCallbackStubMock : public SleSsapClientCallbackStub {
    public:
        void OnFindService(uint8_t clientId, uint16_t connectId, const SsapClientFindServiceRes &result, uint32_t errCode)
        {
            return;
        }
        void OnFindProperty(uint8_t clientId, uint16_t connectId, const SsapClientFindPropertyRes &result, uint32_t errCode)
        {
            return;
        }
        void OnFindComplete(uint8_t clientId, uint16_t connectId, uint8_t type, const Uuid &uuid, uint32_t errCode)
        {
            return;
        }
        void OnWriteResult(uint8_t clientId, uint16_t connectId, uint16_t handle, uint8_t type, uint32_t errCode)
        {
            return;
        }
        void OnReadResult(uint8_t clientId, uint16_t connectId, const SsapClientHandleValue &value, uint32_t errCode)
        {
            return;
        }
        void OnReadByUuidComplete(uint8_t clientId, uint16_t connectId, uint8_t type, const Uuid &uuid, uint32_t errCode)
        {
            return;
        }
        void OnExchangeInfo(uint8_t clientId, uint16_t connectId, uint32_t mtu, uint16_t version, uint32_t errCode)
        {
            return;
        }
        void OnNotification(uint8_t clientId, uint16_t connectId, const SsapClientHandleValue &value, uint32_t errCode)
        {
            return;
        }
        void OnIndication(uint8_t clientId, uint16_t connectId, const SsapClientHandleValue &value, uint32_t errCode)
        {
            return;
        }
};

HWTEST_F(SleSsapClientCallbackTest, RegisterSsapClient_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;
    Uuid uuid;
    uint8_t clientId = 0;
    sptr<SleSsapClientCallbackStubMock> callback = new SleSsapClientCallbackStubMock();
    SleErrorCode result = sscsserver.RegisterSsapClient(uuid, clientId, callback);
    ASSERT_EQ(SLE_ERR_FAILED, result);
}

HWTEST_F(SleSsapClientCallbackTest, UnregisterSsapClient_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 0;
    sptr<SleSsapClientCallbackStubMock> callback = new SleSsapClientCallbackStubMock();
    SleErrorCode result = sscsserver.UnregisterSsapClient( clientId, callback);
    ASSERT_EQ(SLE_ERR_FAILED, result);
}


HWTEST_F(SleSsapClientCallbackTest, FindSsapStructure_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    SsapClientFindStructure param;
    SleErrorCode result = sscsserver.FindSsapStructure( clientId,  connectId,  param);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}


HWTEST_F(SleSsapClientCallbackTest, ReadRequestByUuid_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    SsapClientReadReqByUUID param;

    SleErrorCode result = sscsserver.ReadRequestByUuid( clientId,  connectId, param);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}

HWTEST_F(SleSsapClientCallbackTest, ReadRequest_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    uint16_t handle = 0; uint8_t type = 0;

    SleErrorCode result = sscsserver.ReadRequest( clientId,  connectId,  handle,  type);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}



HWTEST_F(SleSsapClientCallbackTest, WriteRequest_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    SsapClientHandleValue value;

    SleErrorCode result = sscsserver.WriteRequest( clientId,  connectId,   value);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}

HWTEST_F(SleSsapClientCallbackTest, WriteCommand_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    SsapClientHandleValue value;

    SleErrorCode result = sscsserver.WriteCommand( clientId, connectId, value);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}


HWTEST_F(SleSsapClientCallbackTest, ExchangeInfo_001, testing::ext::TestSize.Level0)
{
    SleSsapClientServer sscsserver;

    uint8_t clientId = 1;
    uint16_t connectId = 1;
    uint32_t mtu = 1;
    uint16_t version = 1;

    SleErrorCode result = sscsserver.ExchangeInfo( clientId,  connectId,  mtu, version);
    ASSERT_EQ(SLE_ERR_CHECKOUT_FAILED, result);
}


}}}